home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
dev
/
m2
/
ModGen.lha
/
ModGen
/
ModGen.doc
< prev
next >
Wrap
Text File
|
1995-04-20
|
11KB
|
261 lines
Documentation to the program
______
/| /| / /
/ | / | ____ ____ / / ____ ____ ____
/ | / | / / / / / / /___/ / /
/ |/ | /____/ /____/ /_____/ /___ / / V1.0
(c) 1995 by Frank Lömker
E-Mail: floemker@techfak.uni-bielefeld.de
ModGen is based directly on
- OG V37.11 by Thomas Igracki and
- GenOberon V1.0 by Kai Bolay and Jan van den Baard.
Copyright:
~~~~~~~~~
The program is Freeware. It is freely distributable and may be changed
and recompiled as long as no profit is taken out of it. Changes must be
documented.
Libraries:
~~~~~~~~~
The program needs the following external libraries:
- reqtools.library V38 ( (c) by Nico François )
- nofrag.library V2 ( (c) by Jan van den Baard )
- gadtoolsbox.library V39 ( (c) by Jan van den Baard )
Should the program be able to load crunched files, the library
- powerpacker.library V35 ( (c) by Nico François )
will be needed.
Program:
~~~~~~~
ModGen is a modula source code generator for GadToolsBox V2.0. It generates
code for the compiler Turbo Modula-2 V1.40 by Amritpal Mann.
From Workbench you can pass 3 arguments to ModGen. The 1. argument is the
GUI-file, which should be converted. The 2. argument is the name of the
sourcecode to be generated by ModGen and the 3. argument is the name of the
sourcecode for the screen, if an extrafile should be generated for this.
From Shell the start looks like this:
Format: ModGen [<GUIFile>] [<DestFile>] [<ScreenFile>] [OPENFONT]
[SYSFONT] [RASTER] [UNDERMOUSE] [PORT] [ICON] [NOGUI]
[OPT OSRUPI]
Template: NAME,TO=AS,SCREEN,OPENFONT/S,SYSFONT/S,RASTER/S,UNDERMOUSE/S,
PORT/S,ICON/S,NOGUI/S,OPT/K
The first 3 arguments ([<GUIFile>] [<DestFile>] [<ScreenFile>]) are
identical to the Workbench arguments.
The other arguments:
NOGUI
ModGen opens no window. If NOGUI is not given, the other arguments
(OPENFONT - ICON or OPT) will be ignored.
OPENFONT or OPT O
If the option "Font Adaptive" from the preferences of GadToolsBox
is not selected for the GUI-file and a diskfont is used, the code that
will open and close the used font will be generated.
SYSFONT or OPT S
If the option "Font Adaptive" from the preferences of GadToolsBox
is selected for the GUI-file the generated source will adapt to the
system default font, if this option is selected. When this option is
off the generated source will use the screen font to adapt to.
RASTER or OPT R
The generated windows will be filled with a raster which is used by
GadToolsBox and the auto-requester of the Workbench (and also by
ModGen).
UNDERMOUSE or OPT U
The generated windows will be opened under the mouse.
PORT or OPT P
The windows will share one MessagePort. So the messages for all
windows can be received on this one port.
ICON or OPT I
If the generated files don't have an icon, they will be saved with
the icon "MODULA:Icons/txt".
If NOGUI is not given or the program is started from Workbench, ModGen
will first load the preferences (the state of the options OPENFONT - ICON)
from the file "ENV:GadToolsBox/GenMod.prefs". Then a window is opened
where the program can be controled:
Source, Dest, Screen
This names are equivalent to the 3 Workbench arguments. The gadgets to
the right of the string gadgets can be used to pop up a filerequester
in which you can select the files.
Preferences
This options are equivalent to the options, which can be passed from
shell.
Windows
In this listview all the windows of the GUI-file and the screen are
listed. If only a part of the code should be generated, the range can
be selected at this place.
from
If this gadget is selected, it is possible to select in the listview
the first bound of the area, which should be saved.
to
If this gadget is selected, it is possible to select in the listview
the second bound of the area, which should be saved.
All
The complete sourcecode (all windows and the screen) is generated in
the file <Dest>.
Selected
Only sourcecode for the area, which is selected by from and to, is
generated. If the screen is included in this area, the sourcecode for
this is saved under the name <Screen>. The remaining code is saved in
the file <Dest>. This code imports the part for the screen from the
file <Screen>, so that this name is needed even if the screen is not
in the selected area.
SavePref
The preferences are saved in the files "ENV:GadToolsBox/GenMod.prefs"
and "ENVARC:GadToolsBox/GenMod.prefs"
About
This shows some information about ModGen.
Quit and Closegadget
The program quits.
The generated sourcecode:
~~~~~~~~~~~~~~~~~~~~~~~~
If the GETFILE-gadget is used, the generated code imports the module
GetFile. Furthermore, you must link with the object code "InitGetC.o",
which containes the dispatcher for the BOOPSI-image.
From here on mean:
<Project-Name> Name entered in the Edit Data requester from the
Window menu
<Gadget-Label> Name entered in a Label gadget of one of the gadget kind
requester
<Menu-Label> Name entered in the Label gadget of the Menu Editor
Following exported routines are generated:
PROCEDURE SetupScreen (): INTEGER , with a Customscreen and the Workbench
PROCEDURE SetupScreen (pub:y.ADDRESS): INTEGER with a Publicscreen
This routine will open or lock the screen and get it's visual info. When
requested this routine will also open the font. Also it will test the
setup of the boopsi image for the GETFILE gadget when such a gadget is
used.
This procedure is in the file <Screen> if Selected is used to generate
the code.
The RETURN codes:
0 No error.
1 Could not open or lock the screen.
2 Could not get the screen it's visual info.
3 Could not open the font.
4 Could not set-up the GETFILE boopsi class.
PROCEDURE CloseDownScreen;
This routine will free the resources taken by SetupScreen. This routine
must even be called if SetupScreen returned an error.
This procedure is in the file <Screen> if Selected is used to
generate the code.
PROCEDURE Create<Project-Name>Gadgets (): INTEGER;
There are as much of these routines as there are Project Windows with
gadgets in the generated file. These routines will set-up the gadgets.
The RETURN codes:
0 No error.
1 Could not create a gadget context.
2 Error during the gadget creation.
7 Could not get a GETFILE boopsi object.
8 CloneTagItems was not possible.
PROCEDURE Open<Project-Name>Window (createGads: BOOLAN): INTEGER;
if the window has gadgets
PROCEDURE Open<Project-Name>Window (): INTEGER;
if the window has no gadgets
There are as much of these routines as there are Project Windows in the
generated file. These routines will set-up the gadgets (if present and
asked for) and menus and open the window.
The RETURN codes:
0 No error.
1 Could not create a gadget context.
2 Error during the gadget creation.
3 Could not create the menus.
4 LayoutMenus not possible.
5 Could not open the system font (option SYSFONT).
6 SetMenuStrip not possible.
7 Could not get a GETFILE boopsi object.
8 CloneTagItems was not possible.
20 Could not open the window.
PROCEDURE Close<Project-Name>Window;
There are as much of these routines as there are Project Windows in the
generated file. These routines will free all resources that the
Open<Project_Name>Window routine has taken. This routine must even be
called if Open<Project_Name>Window returned an error.
PROCEDURE <Project-Name>Render;
Each Project Window which has texts or BevelBoxes attached to it or for
which the option RASTER was on, will have a routine which renders these
texts and BevelBoxes and generated the background in the window. This
routine must also be called by the user program upon receiving a
REFRESHWINDOW message at the window port. When such a message is
received this routine must be called between the GT_BeginRefresh and
GT_EndRefresh calls. An example:
IF REFRESHWINDOW <= Class THEN
GT_BeginRefresh (<Project-Name>Wnd);
<Project-Name>Render;
GT_EndRefresh (<Project-Name>Wnd,TRUE);
END;
The generated file also contains the following global variables and
constants:
The variables Scr, VisualInfo, Font, Attr and Topaz80 are in the file
<Screen> if Selected is used to generate the code.
Scr: I.ScreenPtr; Pointer to the opened or locked screen
VisualInfo: y.ADDRESS; Pointer to the visual info of the screen
The following variables are only generated when the file contains gadgets
or menus and when the OpenFont routine is generated and when the window
has a zoom gadget:
<Project-Name>GList: I.GadgetPtr; The created gadgets
<Project-Name>Menus: I.MenuPtr; The created menus
<Project-Name>Zoom: ARRAY [0..3] OF INTEGER; 2. window position
Topaz80: g.TextAttr;
Attr: g.TextAttr; The opened font
Font: g.TextAttrPtr; Pointer to the opened font
Also generated are pointers for each project window:
<Project-Name>Wnd: I.WindowPtr;
The following variables contain the window position:
<Project-Name>Left left edge
<Project-Name>Top top edge
<Project-Name>Width width
<Project-Name>Height height
This variables are initialized in the main part of the generated modul.
Also the generated file contains the gadget array's for each project
window which are defined as following:
<Project-Name>Gadgets: ARRAY [0..<Project-Name>CNT-1] OF I.GadgetPtr;
The constant <Project-Name>CNT contains the number of gadgets in the
window.
To access the pointers in this array the program generates constants which
specify the position of a certain gadget in the array:
GD<Gadget-Label>
The underlined charcters of all gadgets are given in the string
<Project-Name>HotKeys.
Compiling ModGen:
~~~~~~~~~~~~~~~~
To compile ModGen type:
m2b ModGen gtxs.lib nofrags.lib rqtoolss.lib InitGetC.o
Frank